#include "module.h"
#include "tensor.h"
#include <iostream>

#ifndef LINEAR_H
#define LINEAR_H
class Linear : public Module {
    public:
        Linear(int in_features, int out_features, int rquire_bias, int require_grad);
        int in_features;
        int out_features;
        Tensor *forward(Tensor *x) override;
        void backward(Tensor *grad) override;
        void update(float lr) override;
        void mFree() override;

};



Tensor *linear_forword(Tensor *input, Tensor *weight, Tensor *bias);
Tensor *linear_backwardw(Tensor *input, Tensor *grad);
Tensor *linear_backwardb(Tensor *input, Tensor *grad);
Tensor *linear_backwardat(Tensor *weight, Tensor *grad);
void *linear_update(Tensor *weight_grad, Tensor *weight, Tensor *bias_grad, Tensor *bias, float lr, int require_bias);
void linearFree(Linear *linear);

#endif // LINEAR_H